<?php
namespace app\index\controller;

use think\Controller;
use think\Db;
use think\Exception;
use think\Validate;
use think\Cache;
use think\Session;
use think\Request;
use token\Token;
use lib\Rest;

class Mindex extends Controller
{
	function index()
	{	
		
		return view('web/mhome');
	}
	
	function wechat()
	{
		$obj = new Token();
		$token =$obj->getToken();
		dump($token);die;
        
        $signature = $_GET["signature"];
        $timestamp = $_GET["timestamp"];
        $nonce = $_GET["nonce"];
        		
		$token = 'win';
		$tmpArr = array($token, $timestamp, $nonce);
        // use SORT_STRING rule
		sort($tmpArr, SORT_STRING);
		$tmpStr = implode( $tmpArr );
		$tmpStr = sha1( $tmpStr );
		
		if( $tmpStr == $signature ){
			ob_clean();
            echo $_GET['echostr'];
            exit;
		}else{
			return false;
		}

	}

}



